﻿using System;
using ZWFrameWork;
using SCOREEX = System.Double;

public class PlayerInfo
{
    public string szSpreaderAccount { get; private set; }
    public string szQQNumber { get; private set; }
    public string szEmailAddress { get; private set; }
    public string szSeatPhone { get; private set; }
    public string szMobilePhone { get; private set; }
    public string szTrueName { get; private set; }
    public string szAddress { get; private set; }
    public string szPassportID { get; private set; }
    public UInt16 wFaceID { get; set; }
    public byte cbGender { get; private set; }
    public UInt32 dwCustomID { get; private set; }
    public UInt32 dwUserID { get; private set; }
    public UInt32 dwGameID { get; private set; }
    public string szNickName { get; private set; }
    public string szDynamicPass { get; private set; }
    public byte cbEnjoinYuEBao { get; private set; }
    public byte cbYuEBaoEnabled { get; private set; }
    public byte cbIsNewUser { get; private set; }
    public double lWithDrawScore { get; private set; }
    public double lServiceFee { get; private set; }
    public double lRechargeAmount { get; private set; }
    public UInt32 dwLockServerID { get; private set; }
    public UInt32 dwLockKindID { get; private set; }
    public SCOREEX userScore { get; private set; }
    public SCOREEX CoinBuyPropCount { get; set; }
    public void OnSubQueryUserInfoResult(byte[] mainMsg)
    {
        GameUtilty.Info("===========================玩家资料===========================");
        ByteBuffer buffer = new ByteBuffer(mainMsg);
        //先读结构
        CMD_GP_UserIndividual cmd = buffer.ReadObject<CMD_GP_UserIndividual>();
        GameUtilty.Info("=======dwUserID====={0}", cmd.dwUserID);
        int curlen = buffer.getcurlen();
        int datalen = buffer.getlen();
        int tmpSize = 0;
        int tmpCmd = 0;
        while (curlen < datalen)
        {
            tmpSize = buffer.readword();
            tmpCmd = buffer.readword();
            if (tmpSize == null || tmpCmd == null)
            {
                break;
            }

            if (tmpCmd == Protocal.DTP_GP_UI_SPREADER)
            {
                szSpreaderAccount = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_QQ)
            {
                szQQNumber = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_EMAIL)
            {
                szEmailAddress = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_SEAT_PHONE)
            {
                szSeatPhone = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_MOBILE_PHONE)
            {
                szMobilePhone = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_COMPELLATION)
            {
                szTrueName = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_DWELLING_PLACE)
            {
                szAddress = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == Protocal.DTP_GP_UI_PASSPORTID)
            {
                szPassportID = buffer.readstring(tmpSize);
            }
            else if (tmpCmd == 0)
            {
                break;
            }
            else
            {
                for (int index = 1; index < tmpSize + 1; index++)
                {
                    if (buffer.readbyte() == null)
                    {
                        break;
                    }
                }
            }

            curlen = buffer.getcurlen();
        }
    }
    /// <summary>
    /// 收到个人资料后查询银行资料
    /// </summary>
    public void SendQUERY_INSURE_INFO()
    {
        CMD_GP_QueryInsureInfo cmd = new CMD_GP_QueryInsureInfo();
        cmd.dwUserID = dwUserID;
        cmd.szPassword = szDynamicPass;
        LogonClient.Instance.SendData(cmd,Protocal.MDM_GP_USER_SERVICE,Protocal.SUB_GP_QUERY_INSURE_INFO);
    }
    /// <summary>
    /// 更新玩家分数
    /// </summary>
    public void UpdatePlayerScore(CMD_GP_IndividuaResult cm)
    {
        userScore = cm.lCurrScore;
    }
    
    /// <summary>
    /// UpdateLoginInfo
    /// </summary>
    /// <param name="cmd"></param>
    public void UpdateLoginInfo(CMD_MB_LogonSuccess cmd)
    {
        wFaceID = cmd.wFaceID;
        cbGender = cmd.cbGender;
        dwCustomID = cmd.dwCustomID;
        dwUserID = cmd.dwUserID;
        dwGameID = cmd.dwGameID;
        szNickName = cmd.szNickName;
        szDynamicPass = cmd.szDynamicPass;
        cbEnjoinYuEBao = cmd.cbEnjoinYuEBao;
        cbYuEBaoEnabled = cmd.cbYuEBaoEnabled;
        cbIsNewUser = cmd.cbIsNewUser;
        lWithDrawScore = cmd.lWithDrawScore;
        lServiceFee = cmd.lServiceFee;
        lRechargeAmount = cmd.lRechargeAmount;
        dwLockKindID = cmd.dwLockKindID;
        dwLockServerID = cmd.dwLockServerID;
    }

}